﻿@model trangbaocao.Models.Device_StationsModel
<div class="container_12">       
    <div class="grid_12">            
        <div class="module">
                <h2 align="right"><span><a href="@Url.Action("Index", "Device_Stations")">Quay lại</a></span></h2>                       
                <div class="module-body">
                @using (Html.BeginForm("AddDevice_Stations", "Device_Stations", FormMethod.Post, new { id = "AddDevice_Stations" }))
                {                      
                    <div align="center"><h3>THÊM MỚI THIẾT BỊ TRONG TRẠM</h3>
                        <div class="img-device-station-add" align="center"> 
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/Add_Device.png")" width="10%" />
                        </div>
                    </div>
                    
                    if (TempData["msg"] != null)
                    {                            
                        <span class="notification n-error">@TempData["msg"]</span>
                    }  
                    <p></p> 
          <table> 
                    <div style="width:50%; text-align:center; float:left; margin-bottom:5px">
                    <p align="center">
                        <label style="width:55%; text-align:left;">Mã thiết bị:</label>
                        <div class="ma_he_thong" align="center" style="padding-left: 10px; width: 100%">
                            @Html.TextBoxFor(model => model.ma_he_thong, new { @name = "ma_he_thong", @class = "input-medium" })                              
                            <font color="red">(*)</font>
                            <label style="width:60%; text-align:left;">
                            @Html.ValidationMessageFor(model => model.ma_he_thong)
                        </div>                                                                     
                    </p> 
                    <p align="center">
                        <label style="width:55%; text-align:left;">Tên thiết bị:</label>
                        <div class="tendangnhap" align="center" style="padding-left: 10px; width: 100%">
                            @Html.TextBoxFor(model => model.name, new { @name = "name", @class = "input-medium" }) 
                            <font color="red">(*)</font>
                            <label style="width:60%; text-align:left;">
                            @Html.ValidationMessageFor(model => model.name)
                        </label>
                        </div>                                                                     
                    </p>  
                    <p align="center">
                        <label style="width:55%; text-align:left;">Trung tâm:</label>
                        @*@if (Model.trungtam_id != null)
                        { 
                            @Html.DropDownListFor(x => x.main_stations_id, Model.trungtam_id,"---Chọn trung tâm---")                     
                        }*@
                        @if (Model.trungtam_id != null)
                        { 
                            @Html.DropDownListFor(x => x.main_stations_id, Model.trungtam_id)                     
                        }
                    </p>                          
                    <p align="center" style="padding-left:11px; width:100%">
                        <label style="width:60.8%; text-align:left;">Trạm:</label>
                                @*@Html.DropDownListFor(x => x.stations_id, Enumerable.Empty<SelectListItem>(),"---Chọn nhà trạm---")*@
                                 @if (Model.tram_id != null)
                                 {                                  
                                     @Html.DropDownListFor(x => x.stations_id, Model.tram_id)
                                 }
                                <font color="red">(*)</font>
                        <label style="width:60%; text-align:left;">
                        @Html.ValidationMessageFor(model => model.stations_id)
                        </label>                    
                    </p> 
                    <p align="center">
                        <label style="width:55%; text-align:left;">Loại thiết bị:</label>
                        @if (Model.thietbi_id != null)
                        { 
                            @Html.DropDownListFor(x => x.device_id, Model.thietbi_id)                     
                        }
                    </p>
                    
              </div>
              <div style="width:50%; text-align:center; float:right">
                    <div align="center">
                        <label style="width:55%; text-align:left;">Ngày lắp đặt:</label>
                            <p align="center" style="width:55%; text-align:left;">
                                @Html.TextBoxFor(model => model.ngay_lap_dat, new { @name = "ngay_lap_dat", @class = "date" })
                                <font color="red">(*)</font>
                                <label style="width:60%; text-align:left;">
                                @Html.ValidationMessageFor(model => model.ngay_lap_dat)
                                </label>
                            </p>  
                    </div>          
                     <div align="center">
                        <label style="width:55%; text-align:left;">Ngày sử dụng:</label>
                            <p align="center" style="width:55%; text-align:left;">
                                @Html.TextBoxFor(model => model.ngay_su_dung, new { @name = "ngay_su_dung", @class = "date" })
                                <font color="red">(*)</font>
                                <label style="width:60%; text-align:left;">
                                @Html.ValidationMessageFor(model => model.ngay_su_dung)
                                </label>
                            </p> 
                    </div>
                    @*<p align="center">
                        <label style="width:55%; text-align:left;">Số hiệu thuê bao:</label>
                        @Html.TextBoxFor(model => model.so_hieu_tb, new { @name = "so_hieu_tb", @class = "input-medium" })
                    </p>*@
                    
                    @*<div align="center">
                        <label style="width:26%; text-align:left;">Ngày lắp đặt:</label>
                            <p align="center" style="width:27%; text-align:left;">
                        @Html.TextBoxFor(model => model.ngay_lap_dat, new { @name = "ngay_lap_dat", @class = "date" })
                            </p>  
                    </div>          *@           
                    @*<p align="center">
                        <label style="width:55%; text-align:left;">Thông tin TB:</label>
                        @Html.TextBoxFor(model => model.thong_tin_tb, new { @name = "thong_tin_tb", @class = "input-medium" })
                    </p>*@
                    <p align="center">
                        <label style="width:55%; text-align:left;">Trạng thái hoạt động:</label>
                        <select name="trang_thai_hd">
                            <option value="1" selected="selected">Bình thường</option>
                            <option value="0">Ngừng</option>
                        </select>
                        
                    </p>
                    <p align="center">
                        <label style="width:55%; text-align:left;">Người lắp đặt:</label>
                        @Html.TextBoxFor(model => model.nv_lap_dat, new { @name = "nv_lap_dat", @class = "input-medium" })
                    </p> 
                   @* <div align="center">
                        <label style="width:26%; text-align:left;">Ngày sử dụng:</label>
                            <p align="center" style="width:27%; text-align:left;">
                        @Html.TextBoxFor(model => model.ngay_su_dung, new { @name = "ngay_su_dung", @class = "date" })
                            </p> 
                    </div>*@
                    <p align="center">
                        <label style="width:55%; text-align:left;">Ghi chú:</label>
                        @Html.TextBoxFor(model => model.ghi_chu, new { @name = "ghi_chu", @class = "input-medium" })                        
                    </p>
              </div>    
          </table>
                    <div class="button" align="center">
                        <p style="width:26%; text-align:center">
                        <input class="submit-green" type="submit" value="Thêm"/> 
                        <input class="submit-gray" type="reset" value="Hủy" />
                        @*<input class="submit-gray" type="button"  onclick="location.href='@Url.Action("Index", "User")'" value="Quay lại" />*@
                        </p>
                    </div>       
                }
              </div> <!-- End .module-body -->      
                
        </div>  <!-- End .module -->
        <div style="clear:both;"></div>
    </div> <!-- End .grid_12 --> 
    <div style="clear:both;"></div>
</div> <!-- End .container_12 -->

<script type="text/javascript">
    $(document).ready(function () {
        $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
    });
</script>
<script type="text/javascript">
    $("#main_stations_id").change(function () {        
        $.ajax({
            type: "POST",
            url: '@Url.Action("getStationsJson", "Device_Stations")',
            data: { MainStationId: $("#main_stations_id > option:selected").attr("value"), Order: "name" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn nhà trạm---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#stations_id").html(items.join(' '));
            }
        })
    });
</script>


